function plot_solution_2d(function_f, node, elem)

u = function_f(node(:,1), node(:,2));
data = [node, u];

elem = mat2cell(elem, size(elem,1), size(elem,2));
max_n_vertices = max(cellfun(@length, elem));
padding_func = @(vertex_ind) [vertex_ind, NaN(1, max_n_vertices - length(vertex_ind))];
tpad = cellfun(padding_func, elem, 'UniformOutput', false);
tpad = vertcat(tpad{:});
patch('Faces', tpad, 'Vertices', data, 'FaceColor', 'interp', 'CData', u/max(abs(u)));

axis('square');
shift = 0;
xlim([min(node(:,1)) - shift, max(node(:,1)) + shift])
ylim([min(node(:,2)) - shift, max(node(:,2)) + shift])
zlim([min(u) - shift , max(u) + shift])
xlabel('x');
ylabel('y');
zlabel('u');
view(3);
grid on;

end